package com.deepgames.mud.session;

import java.io.IOException;
import java.net.ServerSocket;

/**
 * Server to wait for and assign new sessions.
 * 
 * @author Zack Hoffmann
 * @version 1.0
 *
 */
public class SessionServer extends ServerSocket {

	private SessionManager manager;
	
	/**
	 * Constructor designating the port to listen on and the session manager
	 * 	for this instance.
	 * 
	 * @param port			The port to listen for new connections on.
	 * @param manager		The designated session manager.
	 * @throws IOException
	 */
	public SessionServer(int port, SessionManager manager) throws IOException {
		super(port);
		this.manager = manager;
	}
	
	/*
	 * (non-Javadoc)
	 * @see java.net.ServerSocket#accept()
	 */
	public Session accept() throws IOException {
		Session newSession = new Session(manager);
		super.implAccept(newSession);
		return newSession;
	}

}
